from datetime import datetime,timedelta

def count_interval(create_time):
    create_time = datetime.fromisoformat(create_time)
    now = datetime.now()
    interval = now - create_time
    year = interval.days // 365
    if year:
        return f"{year}年前"
    month = interval.days // 30
    if month:
        return f"{month}月前"
    days = interval.days
    if days:
        return f"{days}天前"
    hours = interval.seconds // 3600
    if hours:
        return f"{hours}小时前"
    minutes = interval.seconds // 60
    if minutes:
        return f"{minutes}分钟前"
    seconds = interval.seconds
    if seconds:
        return f"{seconds}秒前"


if __name__ == "__main__":
    create_time = "2019-12-03 16:51:00"
    result = count_interval(create_time)
    print(result)
